package it.polito.connectedcar.general.network;

import java.io.IOException;
import java.net.DatagramPacket;
import java.net.InetSocketAddress;
import java.net.SocketException;

/**
 * This implementation is a simple datagramSocket. It is used in a real
 * environment where no simulated network delays have to be applied before
 * sending a message.
 * 
 * @author Nicola Aresta
 * 
 */
public class SimpleDatagramSocket extends ConnectedCarSocket {

	public SimpleDatagramSocket() throws SocketException {
		super();
	}

	public SimpleDatagramSocket(int port) throws SocketException {
		super();
	}

	@Override
	public void sendMessage(DatagramPacket p) throws IOException {
		send(p);
	}

	@Override
	public boolean isSameAddress(InetSocketAddress address) {
		return this.getInetAddress().equals(address);
	}
}
